﻿using MediaAdmin.Application;
using MediaAdmin.Application.Config;
using MediaAdmin.Application.Infrastructure;
using Microsoft.WindowsAzure.MediaServices.Client;
using Ninject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;

namespace MediaAdmin.Controllers
{
    public abstract class BaseController : Controller, IModelMapperController
    {
        protected static string NotFoundPage = "~/page-not-found";

        [Inject]
        public IConfig Config { get; set; }

        [Inject]
        public IMapper ModelMapper { get; set; }

        [Inject]
        public CloudMediaContext Context { get; set; }


        public RedirectResult RedirectToNotFoundPage
        {
            get
            {
                return Redirect(NotFoundPage);
            }
        }

        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
        }
    }

    public abstract class BaseApiController : ApiController
    {
        [Inject]
        public IConfig Config { get; set; }

        protected override void Initialize(System.Web.Http.Controllers.HttpControllerContext controllerContext)
        {
            base.Initialize(controllerContext);
        }
    }

    public interface IModelMapperController
    {
        IMapper ModelMapper { get; }
    }

}